package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.OutboundOrderBean;
import com.project.service.IOutboundOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequiresPermissions("outbound")
@RequestMapping("outboundOrder")
public class OutboundOrderController {
    @Autowired
    private IOutboundOrderService outboundOrderService;
    @RequestMapping("out")
    public String out(OutboundOrderBean outboundOrderBean) {//出库
        outboundOrderService.out(outboundOrderBean);
        return "ok";
    }
    @RequestMapping("findByItem")//动态分页查询销售信息表
    public IPage<OutboundOrderBean> findByItem(Integer pageNO, String name,
                                               LocalDate startDate, LocalDate endDate) {
        return outboundOrderService.findByItem(pageNO, name, startDate, endDate);
    }
    @RequestMapping("findById")
    public OutboundOrderBean findById(Integer id) {
//        按销售订单id、查询销售详情。同时查询销售明细信息，在销售明细信息中，需要查询商品名称和品牌
        return outboundOrderService.findById(id);
    }
}
